package com.example.backend.controller.image;

import com.example.backend.service.storage.MinIOService;
import com.example.backend.utils.ResultJson;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/image")
public class ImageController {

    private final MinIOService minIOService;

    @PostMapping("/upload")
    public ResultJson<?> uploadImage(MultipartFile imageFile) throws Exception {
        String s = minIOService.uploadAvatar(imageFile, "1");
        return ResultJson.success(s);
    }
}
